package com.springbootblog.config;

//import com.alibaba.csp.sentinel.annotation.aspectj.SentinelResourceAspect;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * @SentinelResource 注解需要配置这个类
 * @SentinelResource(value = "AddUser", blockHandler = "handleException")
 */
@Configuration
public class SentinelAspectConfig
{
    /*@Bean
    public SentinelResourceAspect sentinelResourceAspect()
    {
        SentinelResourceAspect sentinelResourceAspect = new SentinelResourceAspect();
        return sentinelResourceAspect;
    }//*/
}

/*public Map<String, Object> handleException(BlockException ex)
{
    Map<String, Object> result = new HashMap<>();
    result.put("code", -1);
    result.put("msg", "别急，等一会在请求！");
    return result;
}//*/

